package com.fy.dao;

import com.fy.entity.CarEntity;
import org.springframework.data.neo4j.repository.Neo4jRepository;
import org.springframework.data.neo4j.repository.query.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @ClassName CarRespository
 * @author: maliang
 * @Description 汽车
 * @date 2023/3/30 13:36
 * @Version 1.0版本
 */
@Repository
public interface CarRepository extends Neo4jRepository<CarEntity, Long> {
    @Query(value = "MATCH (p:person)-[:have]->(n:car) WHERE id(p) = $id RETURN n")
    List<CarEntity> getByPersonId(@Param("id") Long id);
}
